  /* auxiliary fields for rkc */


{int n_fields;
 for (n_fields = 0; n_fields < N_FIELDS; n_fields++){
dv_temp.u[n_fields] = malloc((*grd_ptr).n_grid_pts * sizeof(FLOAT));
	if(dv_temp.u[n_fields] == NULL)
		{
		printf("out of memory N=%d, n_fields dv_temp = %d \n",(*grd_ptr).n_grid_pts,n_fields);
		exit(0);
		}
dv_sum.u[n_fields] = malloc((*grd_ptr).n_grid_pts * sizeof(FLOAT));
	if(dv_sum.u[n_fields] == NULL)
		{
		printf("out of memory N=%d, n_fields dv_sum = %d \n",(*grd_ptr).n_grid_pts,n_fields);
		exit(0);
		}
v_temp.u[n_fields] = malloc((*grd_ptr).n_grid_pts * sizeof(FLOAT));
	if(v_temp.u[n_fields] == NULL)
		{
		printf("out of memory N=%d, n_fields v_temp = %d \n",(*grd_ptr).n_grid_pts,n_fields);
		exit(0);
		}
 }
}

	/* The fields */




{int n_field;
 for (n_field = 0; n_field < grd.n_fields; n_field++){
   y.u[n_field] = malloc(grd.n_grid_pts * sizeof(FLOAT));
	if(y.u[n_field] == NULL)
		{
		printf("out of memory N=%d n_fields = %d \n",(*grd_ptr).n_grid_pts,n_field);
		exit(0);
		}
 }}

/* create the stensil fields */

{int n_field;
 for (n_field = 0; n_field < N_FIELDS_MPI; n_field++){
   sfield_recv.s_x_0_u[n_field] = malloc(grd.n_gridpts_2 * sizeof(FLOAT));
	if(sfield_recv.s_x_0_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_2,n_field);
		exit(0);
		}
   sfield_recv.s_x_1_u[n_field] = malloc(grd.n_gridpts_2 * sizeof(FLOAT));
	if(sfield_recv.s_x_1_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_2,n_field);
		exit(0);
		}
   sfield_send.s_x_0_u[n_field] = malloc(grd.n_gridpts_2 * sizeof(FLOAT));
	if(sfield_send.s_x_0_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_2,n_field);
		exit(0);
		}
   sfield_send.s_x_1_u[n_field] = malloc(grd.n_gridpts_2  * sizeof(FLOAT));
	if(sfield_send.s_x_1_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_2,n_field);
		exit(0);
		}
   sfield_recv.s_y_0_u[n_field] = malloc(grd.n_gridpts_1 * sizeof(FLOAT));
	if(sfield_recv.s_y_0_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_1,n_field);
		exit(0);
		}
   sfield_recv.s_y_1_u[n_field] = malloc(grd.n_gridpts_1 * sizeof(FLOAT));
	if(sfield_recv.s_y_1_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_1,n_field);
		exit(0);
		}
   sfield_send.s_y_0_u[n_field] = malloc(grd.n_gridpts_1  * sizeof(FLOAT));
	if(sfield_send.s_y_0_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_1,n_field);
		exit(0);
		}
   sfield_send.s_y_1_u[n_field] = malloc(grd.n_gridpts_1 * sizeof(FLOAT));
	if(sfield_send.s_y_1_u[n_field] == NULL)
		{printf("out of memory N=%d stensil_n = %d \n",(*grd_ptr).n_gridpts_1,n_field);
		exit(0);
		}
 }}


 
 


/* their derivatives (used in evaluating the function) */


{int n_dfields;
 for (n_dfields = 0; n_dfields < N_DERIVS; n_dfields++){
dfields.du[n_dfields] = malloc((*grd_ptr).n_grid_pts * sizeof(FLOAT));
	if(dfields.du[n_dfields] == NULL)
		{
		printf("out of memory N=%d n_dfields = %d \n",(*grd_ptr).n_grid_pts,n_dfields);
		exit(0);
		}
 }
}

/* other auxiliary fields */

{int n_auxfields;
 for (n_auxfields = 0; n_auxfields < N_AUX; n_auxfields++){
auxfields.u_aux[n_auxfields] = malloc((*grd_ptr).n_grid_pts * sizeof(FLOAT));
	if(auxfields.u_aux[n_auxfields] == NULL)
		{
		printf("out of memory N=%d n_auxfields = %d \n",(*grd_ptr).n_grid_pts,n_auxfields);
		exit(0);
		}
 }
}

/* plot vector memory */

   plot.plot_field = malloc((plot.grid_plot_pts_1  * plot.grid_plot_pts_2) * sizeof(FLOAT));
                    if(plot.plot_field == NULL)
		{
		printf("out of memory N=%d\n",plot.grid_plot_pts_1  * plot.grid_plot_pts_2);
		exit(0);
		}
